﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

/**
 * @file BasicEffectMaterial
 * 
 * The material use default XNA shader
 * 
 * @author LeonXie
 * */

namespace Catsland.Core {

    /**
     * @brief The material use default XNA shader
     * */
    public class BasicEffectMaterial : Material {
        public BasicEffectMaterial(String name, BasicEffect effect, Texture2D texture)
            : base(name, effect, texture) {
        }

        public override void ConfigureMaterial(Camera camera, Vector3 worldPosition) {
            base.ConfigureMaterial(camera, worldPosition);

            BasicEffect basicEffect = (BasicEffect)_effect;
            basicEffect.World = Matrix.CreateTranslation(worldPosition);
            basicEffect.View = camera.m_view;
            basicEffect.Projection = camera.m_projection;
            basicEffect.VertexColorEnabled = false;
            basicEffect.TextureEnabled = true;
            basicEffect.Texture = _texture;
            basicEffect.Alpha = 1.0f;
        }
    }
}
